$(document).ready(function() {
	
	//Language div's opening and closing codes.
	$(".languageMainLink").click(function(e) {
 		if($(".languageBoxMenuDiv").is(':hidden')) {
			$(".languageBoxMenuDiv").slideDown(200);
		}
		else {
			$(".languageBoxMenuDiv").slideUp(200);
		}
		$('body').one('click',function() {
			$(".languageBoxMenuDiv").slideUp(200);
		  });
		  e.stopPropagation();
	});
	//Language div's opening and closing codes.---END
	
	//Writing the selected language to language div header.
	$(".languageBoxMenuDiv div").click(function() {
		var spanValue = $(this).children("span").text()
		$("img.languageFlag").attr('src', $(this).children("img").attr('src'));
		$("span.languageSpan").text(spanValue);
	});
	//Writing the selected language to language div header.---END
	
	
		
	$(".menuMainHeader").hover(
	  function () {
		$(this).prev("li").children("a").addClass("noBg");
		$(this).children(".menuContent").show();
		$(this).children(".menuMainHeaderLink").addClass("menuMainHeaderLinkHover");
	  }, 
	  function () {
		$(this).prev("li").children("a").removeClass("noBg");
		$(this).children(".menuContent").hide();
		$(this).children(".menuMainHeaderLink").removeClass("menuMainHeaderLinkHover");
	  }
	);
	
	  $(".menuFirstHeader a").hover( function () {
	      $(this).children('img').attr("src", "/content/themes/default/img/menu/menuHomeHover.png");
	  },
	  function () {
	      $(this).children('img').attr("src", "/content/themes/default/img/menu/menuHome.png");
	  } 
	);

	//jquery tabs 
	$(".menuInnerHeaders ul li a").hover( function () {
		$(".menuInnerHeaders ul li a").removeClass("activeInnerMenuLink")
	  });
	  
	//branches tabs2
	$('.homeContentTabDiv').hide(); // Hide all divs
	$('.homeContentTabContents .homeContentTabDiv:first').show(); // Show the first div
	$('.homeContentTabHeaders li:first a').addClass('selected '); // Set the class for active state
	$('.homeContentTabHeaders li a').click(function(){ // When link is clicked
	$('.homeContentTabHeaders li a').removeClass('selected '); // Remove active class from links
	$(this).addClass('selected '); //Set parent of clicked link class to active
	
	var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
	$('.homeContentTabDiv').hide(); // Hide all divs
	$(currentTab).show(); // Show div with id equal to variable currentTab
	return false;
	});
	
	$(".homeBannerVideoBg").click(function(){ 
		alert("OOOOOOOOOOO")
	});

//<![CDATA[
	$(".default-usage-select").selectbox().bind('change', function(){
		$('<div>Value of #default-usage-select changed to: '+$(this).val()+'</div>').appendTo('#demo-default-usage .demoTarget').fadeOut(5000, function(){
			$(this).remove();
		});
	});
//]]>

	$('.homeBanner').layerSlider({
		skin : 'lightskin',
		skinsPath : '../layerslider/skins/'
	});

});